import 'package:flutter/material.dart';
import 'package:flutterapp/utils/navigator_utils.dart';

import '11_1_file_operation_route.dart';
import '11_2_http_client.dart';
import '11_4_dio_chunk_download.dart';
import '11_3_dio_route.dart';
import '11_5_websocket.dart';
import '11_6_socket.dart';
import '11_7_json_to_model.dart';

/// @date 2020/08/25  14:56
/// @author 程志强
/// @des 文件和网络操作

class ElevenMainRoute extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("自定义组件"),
      ),
      body: Container(
        margin: const EdgeInsets.symmetric(horizontal: 20),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            RaisedButton(
                child: Text("文件操作"),
                onPressed: () =>
                    NavigatorUtil.goPageByPush(context, FileOperationRoute())),
            RaisedButton(
                child: Text("网络请求：HttpClient"),
                onPressed: () =>
                    NavigatorUtil.goPageByPush(context, HttpClientRoute())),
            RaisedButton(
                child: Text("网络请求：Dio"),
                onPressed: () =>
                    NavigatorUtil.goPageByPush(context, DioRoute())),
            RaisedButton(
                child: Text("网络请求：分块下载文件"),
                onPressed: () =>
                    NavigatorUtil.goPageByPush(context, ChunkDownload())),
            RaisedButton(
                child: Text("webSocket"),
                onPressed: () =>
                    NavigatorUtil.goPageByPush(context, WebSocketRoute())),
            RaisedButton(
                child: Text("socket"),
                onPressed: () =>
                    NavigatorUtil.goPageByPush(context, SocketApiRoute())),
            RaisedButton(
                child: Text("Json转Dart Model类"),
                onPressed: () =>
                    NavigatorUtil.goPageByPush(context, JsonModelRoute())),
          ],
        ),
      ),
    );
  }
}
